<#include "../common/base.ftl">
<@body>
<div class="wu-toolbar-search" id="tb">
    <label>商品编号：</label><input class="wu-text" id="productId" style="width:100px">
    <label>商品名称：</label><input class="wu-text" id="productName" style="width:100px">
    <label>类型：</label><input class="wu-text" id="type" style="width:100px">
    <label>起始时间：</label><input id="startTime" class="easyui-datebox" style="width:100px" data-options="editable:false">
    <label>结束时间：</label><input id="endTime" class="easyui-datebox" style="width:100px" data-options="editable:false">
    <a class="easyui-linkbutton" iconCls="icon-search" onclick="find()">条件搜索</a>
</div>
<table id="tt" >
</table>
</@body>
<@js>
<script type="text/javascript">
$(function(){
    $('#tt').datagrid({
        singleSelect:false,
        idField:'orderId',
        rownumbers:true,
        toolbar: '#tb',
        pageSize:20,
        pagination:true,
        fitColumns:true,
        fit:true,
        method:'get',
        url:'/product/getData',
        columns:[[
            {field:'productId',title:'商品编号',width:60,algin: 'center'},
            {field:'productName',title:'商品名称',width:100,sortable:false,align: 'center'},
            {field:'productPrice',title:'商品价格()',width:100,sortable:false,align: 'center'},
            {field:'productStock',title:'商品库存',width:100,sortable:false,align: 'center'},
            {field:'productDescription',title:'商品介绍',width:100,sortable:false,align: 'center'},
            {field:'categoryType',title:'商品类型',width:100,sortable:false,align: 'center'},
            {field:'productStatus',title:'状态',width:100,sortable:false,align: 'center'},
            {field:'createTime',title:'创建时间',width:80,align:'center'}
        ]]
    })
});
$(function () {
    $("#startTime").datebox("setValue", myformatter(getCurrentMonthFirst()));
    var curr_time = new Date();
    $("#endTime").datebox("setValue", myformatter(curr_time));
});
function getCurrentMonthFirst() {
    var date = new Date();
    date.setDate(1);
    return date;
}
function myformatter(date) {
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    var d = date.getDate();
    return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
}
function find() {
    $('#tt').datagrid('load',{
        startTime:$('#startTime').datebox('getValue'),
        endTime:$('#endTime').datebox('getValue'),
        productId:$('#productId').val(),
        productName:$('#productName').val(),
    })
}
</script>
</@js>

